home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Complete Linux
/
Complete Linux.iso
/
xwindows
/
demos
/
xfract_1.z
/
xfract_1
/
xfractint-1.06
/
cmdfiles.c
< prev
next >
Wrap
C/C++ Source or Header
|
1992-09-28
|
62KB
|
2,029 lines
/*
Command-line / Command-File Parser Routines
This module is linked as an overlay, use ENTER_OVLY and EXIT_OVLY.
*/
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <float.h>
#include <ctype.h>
#include <time.h>
#ifndef XFRACT
#include <bios.h>
#endif
#include "fractint.h"
#include "fractype.h"
#ifdef __TURBOC__
#include <dir.h>
#endif
#include "prototyp.h"
#ifdef XFRACT
#define DEFAULT_PRINTER 5 /* Assume a Postscript printer */
#define PRT_RESOLUTION 100 /* Assume medium resolution */
#define INIT_GIF87 0 /* Turn on GIF 89a processing */
#else
#define DEFAULT_PRINTER 2 /* Assume an IBM/Epson printer */
#define PRT_RESOLUTION 60 /* Assume low resolution */
#define INIT_GIF87 0 /* Turn on GIF 89a processing */
#endif
static int cmdfile(FILE *,int);
static int next_command(char *,int,FILE *,char *,int *,int);
static int next_line(FILE *,char *,int);
int cmdarg(char *,int);
static void argerror(char *);
static void initvars_run(void);
static void initvars_restart(void);
static void initvars_fractal(void);
static void initvars_3d(void);
static void reset_ifs_defn(void);
static void parse_textcolors(char *value);
static int parse_colors(char *value);
static int parse_printer(char *value);
/* variables defined by the command line/files processor */
int showdot; /* color to show crawling graphics cursor */
char temp1[256]; /* temporary strings */
char readname[80]; /* name of fractal input file */
char gifmask[13] = {""};
char PrintName[80]={"fract001.prn"}; /* Name for print-to-file */
char savename[80]={"fract001"}; /* save files using this name */
char autoname[80]={"auto.key"}; /* record auto keystrokes here */
int potflag=0; /* continuous potential enabled? */
int pot16bit; /* store 16 bit continuous potential values */
int gif87a_flag; /* 1 if GIF87a format, 0 otherwise */
int dither_flag; /* 1 if want to dither GIFs */
int askvideo; /* flag for video prompting */
char floatflag;
int biomorph; /* flag for biomorph */
int usr_biomorph;
int forcesymmetry; /* force symmetry */
int showfile; /* zero if file display pending */
int rflag, rseed; /* Random number seeding flag and value */
int decomp[2]; /* Decomposition coloring */
int distest;
int distestwidth;
char overwrite = 0; /* 0 if file overwrite not allowed */
int soundflag; /* 0 if sound is off, 1 if on */
int basehertz; /* sound=x/y/x hertz value */
int debugflag; /* internal use only - you didn't see this */
int timerflag; /* you didn't see this, either */
int cyclelimit; /* color-rotator upper limit */
int inside; /* inside color: 1=blue */
int fillcolor; /* fillcolor: -1=normal */
int outside; /* outside color */
int finattract; /* finite attractor logic */
int display3d; /* 3D display flag: 0 = OFF */
int overlay3d; /* 3D overlay flag: 0 = OFF */
int init3d[20]; /* '3d=nn/nn/nn/...' values */
int initbatch; /* 1 if batch run (no kbd) */
unsigned initsavetime; /* autosave minutes */
double initorbit[2]; /* initial orbitvalue */
char useinitorbit; /* flag for initorbit */
int initmode; /* initial video mode */
int initcyclelimit; /* initial cycle limit */
BYTE usemag; /* use center-mag corners */
int bailout; /* user input bailout value */
double inversion[3]; /* radius, xcenter, ycenter */
int rotate_lo,rotate_hi; /* cycling color range */
int far *ranges; /* iter->color ranges mapping */
int rangeslen = 0; /* size of ranges array */
char far *mapdacbox = NULL; /* map= (default colors) */
int colorstate; /* 0, dacbox matches default (bios or map=) */
/* 1, dacbox matches no known defined map */
/* 2, dacbox matches the colorfile map */
int colorpreloaded; /* if dacbox preloaded for next mode select */
extern int Targa_Overlay;
int Targa_Out = 0;
char colorfile[80]; /* from last <l> <s> or colors=@filename */
int functionpreloaded; /* if function loaded for new bifs, JCO 7/5/92 */
/* TARGA+ variables */
int TPlusFlag; /* Use the TARGA+ if found */
int MaxColorRes; /* Default Color Resolution if available */
int PixelZoom; /* TPlus Zoom Level */
int NonInterlaced; /* Non-Interlaced video flag */
/* 3D Transparency Variables, MCP 5-30-91 */
double xcoord, ycoord, zcoord, tcoord;
double zzmin, zzmax; /* initial depth corner values */
double ttmin, ttmax; /* initial time coordinates */
int Transparent3D, SolidCore, MultiDrawing;
int tpdepth, tptime;
unsigned CoreRed, CoreGreen, CoreBlue, NumFrames;
/* AntiAliasing variables, MCP 6-6-91 */
int AntiAliasing, Shadowing;
int orbitsave = 0; /* for IFS and LORENZ to output acrospin file */
int orbit_delay; /* clock ticks delating orbit release */
extern int invert;
extern int fractype; /* fractal type */
extern double param[4]; /* initial parameters */
extern double xxmin,xxmax; /* initial corner values */
extern double yymin,yymax; /* initial corner values */
extern double xx3rd,yy3rd; /* initial corner values */
extern char usr_stdcalcmode; /* '1', '2', 'g', 'b' */
extern int maxit; /* max iterations */
extern int usr_periodicitycheck; /* periodicity checking 1=on,0=off */
extern char usr_floatflag; /* flag for float calcs */
extern int usr_distest; /* nonzero if distance estimator option */
extern char color_lakes; /* finite attractor flag */
extern int haze;
extern int RANDOMIZE;
extern int Ambient;
extern char light_name[];
extern int BRIEF;
extern int RAY;
extern BYTE back_color[];
extern BYTE dacbox[256][3];
extern struct videoinfo far videotable[];
extern int fpu;
extern int iit;
extern double potparam[]; /* potential parameters */
extern int Printer_Resolution, LPTNumber,
Printer_Type, Printer_Titleblock,
Printer_ColorXlat, Printer_SetScreen,
Printer_SFrequency, Printer_SAngle, Printer_SStyle,
Printer_RFrequency, Printer_RAngle, Printer_RStyle,
Printer_GFrequency, Printer_GAngle, Printer_GStyle,
Printer_BFrequency, Printer_BAngle, Printer_BStyle,
Printer_Compress,
EPSFileType, ColorPS,
Print_To_File,Printer_CRLF; /* for printer functions */
int transparent[2]; /* transparency min/max values */
int LogFlag; /* Logarithmic palette flag: 0 = no */
BYTE exitmode = 3; /* video mode on exit */
extern int video_type;
extern int svga_type; /* for forcing a specific SVGA adapter */
extern int mode7text;
extern int textsafe;
extern int vesa_detect;
char ai_8514; /* Flag for using 8514a afi JCO 4/11/92 */
int bios_palette; /* set to 1 to force BIOS palette updates */
int escape_exit; /* set to 1 to avoid the "are you sure?" screen */
extern int viewwindow;
extern float viewreduction;
extern int viewcrop;
extern float finalaspectratio;
extern int viewxdots,viewydots;
extern char MAP_name[];
extern int mapset;
extern int eyeseparation; /* Occular Separation */
extern int glassestype;
extern int xadjust; /* Convergence */
extern int yadjust;
extern int xtrans, ytrans; /* X,Y shift with no perspective */
extern int red_crop_left, red_crop_right;
extern int blue_crop_left, blue_crop_right;
extern int red_bright, blue_bright;
extern char showbox; /* flag to show box and vector in preview */
extern char preview; /* 3D preview mode flag */
extern int previewfactor; /* Coarsness */
int first_init=1; /* first time into cmdfiles? */
static int init_rseed;
static char initcorners,initparams;
struct fractalspecificstuff far *curfractalspecific;
char FormFileName[80]; /* file to find (type=)formulas in */
char FormName[ITEMNAMELEN+1]; /* Name of the Formula (if not null) */
char LFileName[80]; /* file to find (type=)L-System's in */
char LName[ITEMNAMELEN+1]; /* Name of L-System */
char CommandFile[80]; /* file to find command sets in */
char CommandName[ITEMNAMELEN+1];/* Name of Command set */
char CommandComment1[57]; /* comments for command set */
char CommandComment2[57];
char IFSFileName[80]; /* file to find (type=)IFS in */
char IFSName[ITEMNAMELEN+1]; /* Name of the IFS def'n (if not null) */
float far *ifs_defn = NULL; /* ifs parameters */
int ifs_changed; /* nonzero if parameters have been edited */
int ifs_type; /*